import { ApiProperty } from '@midwayjs/swagger';
import { Rule, RuleType } from '@midwayjs/validate';
import { Column, Entity, PrimaryColumn } from 'typeorm';
@Entity({
  name: 'Transporting',
  synchronize: false,
})
export class Transporting {
  @ApiProperty({ example: 'TS001' })
  @Rule(RuleType.string().required())
  @PrimaryColumn({
    type: 'varchar',
    length: 20,
  })
  transportingId: string;

  @ApiProperty({ example: '谷丰贸易有限公司' })
  @Rule(
    RuleType.string()
      .pattern(/^.{4,8}$/)
      .required()
  )
  @Column()
  reciever: string;

  @Rule(RuleType.date().required())
  @ApiProperty({ example: '2022-03-05T12:00:55' })
  @Column()
  recieveTime: Date;

  @Rule(RuleType.string().required())
  @ApiProperty({ example: '巧克力' })
  @Column()
  name: string;
}

export class TransportingDto4Modify {
  @ApiProperty({ example: '谷丰贸易有限公司' })
  @Rule(RuleType.date().required())
  reciever: string;

  @ApiProperty({ example: '巧克力' })
  @Rule(RuleType.string().required())
  name: string;
}
